(()=>{"use strict";var e={d:(o,t)=>{for(var n in t)e.o(t,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:t[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},o={};e.d(o,{Dropbox:()=>W});var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])},t(e,o)};function n(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var o,t=1,n=arguments.length;t0))throw new Error("Old style url as callback is only supported for single files.");r.filename||(r.filename=N(r.url))}}return t};Dropbox.save=function(){for(var e=[],n=0;n=0||i.className.indexOf("dropbox-dropin-default")>=0||i.className.indexOf("dropbox-dropin-disabled")>=0){var o=("function"==typeof n.files?n.files():void 0)||n.files;if(!(null!=o?o.length:void 0))return i.className="dropbox-dropin-btn dropbox-dropin-error",void("function"==typeof n.error&&n.error("Missing files"));Dropbox.save({files:o,success:function(){i.className="dropbox-dropin-btn dropbox-dropin-success","function"==typeof n.success&&n.success()},progress:function(e){i.className="dropbox-dropin-btn dropbox-dropin-progress","function"==typeof n.progress&&n.progress(e)},cancel:function(){"function"==typeof n.cancel&&n.cancel()},error:function(e){i.className="dropbox-dropin-btn dropbox-dropin-error","function"==typeof n.error&&n.error(e)}})}})),i};var r=function(e,o){return" background: ".concat(e,";\n background: -moz-linear-gradient(top, ").concat(e," 0%, ").concat(o," 100%);\n background: -webkit-linear-gradient(top, ").concat(e," 0%, ").concat(o," 100%);\n background: linear-gradient(to bottom, ").concat(e," 0%, ").concat(o," 100%);\n filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='").concat(e,"', endColorstr='").concat(o,"',GradientType=0); ")},p=document.createElement("style");p.type="text/css";var m=' @-webkit-keyframes rotate {\n from { -webkit-transform: rotate(0deg); }\n to { -webkit-transform: rotate(360deg); }\n }\n\n @keyframes rotate {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n .dropbox-dropin-btn, .dropbox-dropin-btn:link, .dropbox-dropin-btn:hover {\n display: inline-block;\n height: 14px;\n font-family: "Lucida Grande", "Segoe UI", "Tahoma", "Helvetica Neue", "Helvetica", sans-serif;\n font-size: 11px;\n font-weight: 600;\n color: #636363;\n text-decoration: none;\n padding: 1px 7px 5px 3px;\n border: 1px solid #ebebeb;\n border-radius: 2px;\n border-bottom-color: #d4d4d4;\n '.concat(r("#fcfcfc","#f5f5f5"),"\n }\n\n .dropbox-dropin-default:hover, .dropbox-dropin-error:hover {\n border-color: #dedede;\n border-bottom-color: #cacaca;\n ").concat(r("#fdfdfd","#f5f5f5"),"\n }\n\n .dropbox-dropin-default:active, .dropbox-dropin-error:active {\n border-color: #d1d1d1;\n box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);\n }\n\n .dropbox-dropin-btn .dropin-btn-status {\n display: inline-block;\n width: 15px;\n height: 14px;\n vertical-align: bottom;\n margin: 0 5px 0 2px;\n background: transparent url('").concat(Dropbox.baseUrl,"/static/metaserver/static/images/widgets/dbx-saver-status.png') no-repeat;\n position: relative;\n top: 2px;\n }\n\n .dropbox-dropin-default .dropin-btn-status {\n background-position: 0px 0px;\n }\n\n .dropbox-dropin-progress .dropin-btn-status {\n width: 18px;\n margin: 0 4px 0 0;\n background: url('").concat(Dropbox.baseUrl,"/static/metaserver/static/images/widgets/dbx-progress.png') no-repeat center center;\n -webkit-animation-name: rotate;\n -webkit-animation-duration: 1.7s;\n -webkit-animation-iteration-count: infinite;\n -webkit-animation-timing-function: linear;\n animation-name: rotate;\n animation-duration: 1.7s;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n }\n\n .dropbox-dropin-success .dropin-btn-status {\n background-position: -15px 0px;\n }\n\n .dropbox-dropin-disabled {\n background: #e0e0e0;\n border: 1px #dadada solid;\n border-bottom: 1px solid #ccc;\n box-shadow: none;\n }\n\n .dropbox-dropin-disabled .dropin-btn-status {\n background-position: -30px 0px;\n }\n\n .dropbox-dropin-error .dropin-btn-status {\n background-position: -45px 0px;\n }\n\n @media only screen and (-webkit-min-device-pixel-ratio: 1.4) {\n .dropbox-dropin-btn .dropin-btn-status {\n background-image: url('").concat(Dropbox.baseUrl,"/static/metaserver/static/images/widgets/dbx-saver-status-2x.png');\n background-size: 60px 14px;\n -webkit-background-size: 60px 14px;\n }\n\n .dropbox-dropin-progress .dropin-btn-status {\n background: url('").concat(Dropbox.baseUrl,"/static/metaserver/static/images/widgets/dbx-progress-2x.png') no-repeat center center;\n background-size: 20px 20px;\n -webkit-background-size: 20px 20px;\n }\n }\n\n .dropbox-saver:hover, .dropbox-chooser:hover {\n text-decoration: none;\n cursor: pointer;\n }\n\n .dropbox-chooser, .dropbox-dropin-btn {\n line-height: 11px !important;\n text-decoration: none !important;\n box-sizing: content-box !important;\n -webkit-box-sizing: content-box !important;\n -moz-box-sizing: content-box !important;\n }\n ");p.styleSheet?p.styleSheet.cssText=m:p.textContent=m,document.getElementsByTagName("head")[0].appendChild(p),setTimeout(f,0);var w=function(){document.removeEventListener?document.removeEventListener("DOMContentLoaded",w,!1):document.detachEvent&&document.detachEvent("onreadystatechange",w),f(),E.init()};"interactive"===document.readyState||"complete"===document.readyState?setTimeout(w,0):document.addEventListener?document.addEventListener("DOMContentLoaded",w,!1):document.attachEvent("onreadystatechange",w)}var I=window.location.protocol+"//"+window.location.host,L=function(){function e(o){if(this.origin=I,this.sendMessage=function(e){},this.state={},this.options=o,!this.options)throw new Error("options must be provided");if(!this.options.appKey)throw new Error("appKey must be provided");e.validateOnError(this.options.onError)}return e.validateOnError=function(e){if(e&&"function"!=typeof e)throw new Error("onError must be a function")},e.prototype.setOnError=function(o){e.validateOnError(o),this.options.onError=o},e.prototype.hasOnCloseDialogMessage=function(){return void 0!==this.onCloseDialogMessage},e.prototype.setOnCloseDialogMessage=function(e){if("function"!=typeof e)throw new Error("onCloseDialogMessage must be a function");this.onCloseDialogMessage=e},e.prototype.sendState=function(){this.sendMessage({method:"state",params:this.state})},e.prototype.url=function(){var e=r([{key:"app_key",value:this.options.appKey},{key:"origin",value:this.origin}],this.urlParams(),!0).map((function(e){return"".concat(encodeURIComponent(e.key),"=").concat(encodeURIComponent(e.value))})).join("&");return{pathname:this.urlPathname(),search:"?".concat(e)}},e.prototype.windowDimensions=function(){return{width:735,height:552}},e.prototype.handleMessage=function(e){switch(void 0!==e.sequenceNumber&&this.sendMessage({method:"ack",sequenceNumber:e.sequenceNumber}),e.method){case"origin_request":this.sendMessage({method:"origin"});break;case"ready":this.sendState();break;case"error":this.options.onError&&this.options.onError(e.params);break;case"close_dialog":this.onCloseDialogMessage&&this.onCloseDialogMessage(),this.onCloseDialogMessage=void 0}},e}(),M="https://".concat("www.dropbox.com","/developers/dropins/chooser/js"),A=["text","documents","images","video","audio"],T=function(e){function o(o){var t=e.call(this,o)||this;return t.chooserExtras={},t.validateOptions=function(){var e=function(e,o){if(void 0!==t.options[e]&&typeof t.options[e]!==o)throw new Error("The ".concat(e," option, if provided, must have type ").concat(o))};if(e("linkType","string"),e("_trigger","string"),void 0!==t.options.extensions){if(!(t.options.extensions instanceof Array))throw new Error("The extensions option, if provided, must be an array");for(var o=0,n=t.options.extensions;o=0;o--){var t=e[o],n=(t.getAttribute("class")||"").split(" ");n.indexOf("dropbox-saver")>=0?function(e){Dropbox.createSaveButton({files:function(){return[{url:e.getAttribute("data-url")||e.href,filename:e.getAttribute("data-filename")||O(e.pathname)}]}},e)}(t):n.indexOf("dropbox-embed")>=0&&function(e){var o=e.getAttribute("data-url")||e.href;if(o&&e.parentElement){var t=e.getAttribute("data-file-zoom")||void 0,n=e.getAttribute("data-folder-view")||void 0,i=e.getAttribute("data-folder-header-size")||void 0,r=document.createElement("div");r.classList.add("dropbox-embed-container"),r.style.height=e.getAttribute("data-height")||"100%",r.style.width=e.getAttribute("data-width")||"100%",e.parentElement.replaceChild(r,e),Dropbox.embed({link:o,file:{zoom:t},folder:{view:n,headerSize:i}},r)}}(t)}}}();var W=window.Dropbox;window.Dropbox=o.Dropbox})(); //# sourceMappingURL=dropins_sdk_v2.js.map